local lspsaga = require 'lspsaga'
lspsaga.setup { -- defaults ...
  debug = false,
  use_saga_diagnostic_sign = true,
  -- diagnostic sign
  error_sign = "",
  warn_sign = "",
  hint_sign = "",
  infor_sign = "",
  diagnostic_header_icon = "",
  -- code action title icon
  code_action_icon = "",
  code_action_prompt = {
    enable = true,
    sign = true,
    sign_priority = 40,
    virtual_text = true,
  },
  finder_definition_icon = "",
  finder_reference_icon = "",
  max_preview_lines = 10,
  finder_action_keys = {
    open = "o",
    vsplit = "s",
    split = "i",
    quit = "q",
    scroll_down = "<C-f>",
    scroll_up = "<C-b>",
  },
  code_action_keys = {
    quit = "q",
    exec = "<CR>",
  },
  rename_action_keys = {
    quit = "<C-c>",
    exec = "<CR>",
  },
  definition_preview_icon = "  ",
  border_style = "single",
  rename_prompt_prefix = "➤",
  rename_output_qflist = {
    enable = false,
    auto_open_qflist = false,
  },
  server_filetype_map = {},
  diagnostic_prefix_format = "%d. ",
  diagnostic_message_format = "%m %c",
  highlight_prefix = false,

}


--- In lsp attach function
local map = vim.api.nvim_buf_set_keymap
local keymap = vim.keymap.set
-- keymap("n", "rn", "<cmd>Lspsaga rename<CR>", { silent = true, noremap = true})
keymap("n", "gx", "<cmd>Lspsaga code_action<cr>", {silent = true, noremap = true})
keymap("x", "gx", ":<c-u>Lspsaga range_code_action<cr>", {silent = true, noremap = true})     -- 如何解决
keymap("n", "gh",  "<cmd>Lspsaga hover_doc<cr>", {silent = true, noremap = true})             -- 函数定义
keymap("n", "go", "<cmd>Lspsaga show_line_diagnostics<cr>", {silent = true, noremap = true})  -- 打开当前行warning
keymap("n", "gi", "<cmd>Lspsaga diagnostic_jump_prev<cr>", {silent = true, noremap = true})   -- 打开上一个warning
keymap("n", "gk", "<cmd>Lspsaga diagnostic_jump_next<cr>", {silent = true, noremap = true})   -- 打开下一个warning
-- map(0, "n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1, '<c-u>')<cr>", {})
-- map(0, "n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1, '<c-d>')<cr>", {})
keymap("n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<cr>", {}) -- 上移动
keymap("n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<cr>", {})  -- 下移动
-- preview definition
keymap("n", "gp", "<cmd>Lspsaga preview_definition<CR>", {silent = true, noremap = true})     -- 预览
--
-- vim.cmd('hi default CursorWord cterm=underline gui=underline')
--
--
